#!/bin/sh
#desc: This file extract the kernel and initrd from a already created ISO

if test -f $1; then
	mkdir -p tmp
	sudo mount $1 tmp -o loop || exit 1
 	ROOTFS=../../buildroot/binaries/opendomo/rootfs.i386.ext2
	KERNEL=../../buildroot/binaries/opendomo/bzImage
	cp -v tmp/linux* $KERNEL
	cp -v tmp/init* $ROOTFS.gz
	gunzip $ROOTFS.gz
	cd tmp
	cd ..
	sudo umount tmp
	rm -fr tmp
else
	echo "usage: $0 /full/path/to/distrofile.iso"
	echo ""
fi
